/** @type { HTMLCanvasElement } */
const myCanvas = document.getElementById("myCanvas").transferControlToOffscreen();
const workers = new Worker('./worker/worker.js')
console.log(myCanvas);
console.time("start")
// window.onload = () => {
    workers.postMessage({
        myCanvas,
    }, [myCanvas])
// }
// 监听从 Web Worker 返回的消息
workers.onmessage = (e) => {
    console.log(e);
    console.timeEnd("start")
}
const calcSum = (num) => {
    let sum = 0
    for (let i = 0; i < num; i++) {
        sum += i
    }
    return sum
}
let y = calcSum(100000)
console.log(y);